package com.hamster.crmpre.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hamster.crmpre.pojo.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * 员工管理mapper
 * @author Tarry
 * @create 2019/12/21 15:13
 */
@Mapper
@Repository
public interface EmployeeMapper extends BaseMapper<Employee> {

    /**
     * 对员工记录，逻辑删除
     * @param id  员工id
     * @param inputUser  操作人
     * @param date  操作日期
     */
    @Update("update employee set del = 1,input_user=#{inputUser},input_time=#{inputTime}  where id = #{id}")
    void deleteTag(@Param("id") String id, @Param("inputUser") String inputUser, @Param("inputTime") Date date);

    /**
     * 根据id查询姓名
     * @return
     */
    @Select("select name from employee where id = #{id}")
    String queryNameById(@Param("id") String id);

}
